package com.wing.enums;

import cn.hutool.core.util.ObjectUtil;

public enum MoveDownWarehouseItemStatusEnum {

    wait_out(0,"待出库"),
    out_ing(1,"出库中"),
    wait_in(2,"待入库"),
    in_ing(3,"入库中"),
    finish_in(4,"完成"),
    cancel(-1,"取消");
    
    private final Integer code;
    private final String desc;

    // 构造函数
    MoveDownWarehouseItemStatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    // Getter 方法
    public Integer getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static MoveDownWarehouseItemStatusEnum getByCode(Integer code) {
        for (MoveDownWarehouseItemStatusEnum status : values()) {
            if (status.getCode().equals(code)) {
                return status;
            }
        }
        return null;
    }

    // 可选：如果需要根据code获取desc，可以提供此方法
    public static String getDescByCode(Integer code) {
        MoveDownWarehouseItemStatusEnum status = getByCode(code);
        if (ObjectUtil.isNull(status)) {
            return "";
        }
        return status.getDesc();
    }

}
